package com.aliyun.heiyu.common.source;

import com.alibaba.druid.util.DruidPasswordCallback;
import com.aliyun.heiyu.common.util.SM4Util;

public class DbPasswordCallback extends DruidPasswordCallback {
    private String encryptPassword;

    public DbPasswordCallback(String encryptPassword) {
        this.encryptPassword = encryptPassword;
    }

    @Override
    public char[] getPassword() {
        try {
            return SM4Util.decrypt_CBC(encryptPassword).toCharArray();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;

    }
}
